package com.zhangtai.modules.service.system;

import com.zhangtai.modules.entity.system.AnnouncementEntity;
import com.zhangtai.utils.PageResult;
import com.zhangtai.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/**
 * 公告表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-09-09 09:39:12
 */

public interface AnnouncementService {

    @GetMapping("/findAnnouncementList")
    @ApiOperation(value = "分页查询")
    PageResult queryPage(@RequestParam( value = "title",required = false) String title,
                         @RequestParam( value = "subtitle",required = false) String subtitle,
                         @RequestParam( value = "content",required = false) String content,
                         @RequestParam( value = "type" ,defaultValue = "1") Integer type,
                         @RequestParam( value = "pageNum" ,defaultValue = "1") Integer pageNum,
                         @RequestParam( value = "pageSize" ,defaultValue = "10") Integer pageSize);

    @GetMapping("/infoAnnouncement")
    @ApiOperation(value = "根据id查找")
    AnnouncementEntity getByIdE(@RequestParam("id") Long id);

    @PostMapping("/saveAnnouncement")
    @ApiOperation(value = "保存")
    R saveE(@RequestBody AnnouncementEntity entity);

    @PostMapping("/updateAnnouncement")
    @ApiOperation(value = "修改")
    R updateByIdE(@RequestBody AnnouncementEntity entity);

    @GetMapping("/deleteOneAnnouncement")
    @ApiOperation(value = "根据ID删除")
    R removeOneById(@RequestParam("id") Long id);

    @PostMapping("/deleteAnnouncements")
    @ApiOperation(value = "根据ID集合删除")
    R removeByIdsE(@RequestBody List<Long> ids);
}

